﻿using System;
using RAP.Framework.Libary.DomTemplateBuilder.Attributes;
using RAP.Framework.Libary.DomTemplateBuilder.Handler.Conditional;

namespace RAP.Framework.Libary.DomTemplateBuilder.Element.Conditional
{
	/// <summary>
	/// “否则”分支节点
	/// </summary>
	[TagHandler( typeof( ElseHandler ) )]
    public class Else : ElementBase
    {
        public override void Initialize ( System.Xml.XmlNode node )
        {
            var parentEle = this.Parent as IElseElement;
			if ( parentEle.Else != null )
			{
				throw new Exception ( "任何条件节点只能包含一个Else节点！" );
			}
            parentEle.Else = this;
        }
    }
}
